﻿package game.network.api.fb.data{

	import game.network.api.fb.core.FacebookLimits;

	public class Batch {

		protected var _requests:Array;

		public function Batch () {
			_requests = [];
		}

		public function get requests ():Array {
			return _requests;
		}

		public function add (relativeURL:String, callback:Function = null, params:* = null, requestMethod:String = 'GET'):void {
			if (_requests.length == FacebookLimits.BATCH_REQUESTS) {
				throw new Error((('Facebook limits you to ' + FacebookLimits.BATCH_REQUESTS) + ' requests in a single batch.'));
			}

			_requests.push (new BatchItem(relativeURL, callback, params, requestMethod));
		}

	}
}